(function($) {
    var check = false, isRelative = true;

    $.elementFromPoint = function(x, y)
    {
        if (!document.elementFromPoint)
            return null;

        if (!check)
        {
            var sl;
            if ((sl = $(document).scrollTop()) > 0)
            {
                isRelative = (document.elementFromPoint(0, sl + $(window).height() - 1) == null);
            }
            else if ((sl = $(document).scrollLeft()) > 0)
            {
                isRelative = (document.elementFromPoint(sl + $(window).width() - 1, 0) == null);
            }
            check = (sl > 0);
        }

        if (!isRelative)
        {
            x += $(document).scrollLeft();
            y += $(document).scrollTop();
        }

        return document.elementFromPoint(x, y);
    }

})(jQuery);